<template>
    <div>
        <Header></Header>
        <van-tabs v-model="active" @click="onClick" v-show="$route.path==='/movie'">
            <van-tab title="正在热映">
                <nowplaying></nowplaying>
            </van-tab>
            <van-tab title="即将上映">
                <comingsoon></comingsoon>
            </van-tab>
        </van-tabs>
        <router-view></router-view>
    </div>
</template>

<script>
import Header from '@/components/Header.vue'
import comingsoon from '@/views/Movie/comingsoon.vue'
import nowplaying from '@/views/Movie/nowplaying.vue'
import Vue from 'vue';
import { Tab, Tabs } from 'vant';

Vue.use(Tab);
Vue.use(Tabs);
export default {
    mounted() {
        // window.addEventListener('scroll', this.handleScroll);
    },
    data() {
        return {
            active: 0
        }
    },
    methods: {
        onClick(name, title) {
            console.log(name, title);
        },
        // getScroll() {
        //     return {
        //         left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
        //         top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
        //     };
        // },
        // handleScroll() {
        //     const scrollTop = this.getScroll().top;
        //     if(scrollTop>=200){
        //         document.querySelector('.van-tabs').style.position = 'fixed';
        //         document.querySelector('.van-tabs').style.top = '50px';
        //     }
        // }
    },
    components: {
        Header,
        nowplaying,
        comingsoon
    }
}
</script>

<style></style>
